Component({
  mixins: [],
  data: {
    animation:'',
		userInfo:'',
		// bg:{
		// 	url:'https://img.alicdn.com/imgextra/i1/4161056916/O1CN01wqIQVb20xZqfKvBKl_!!4161056916.png',
		// 	width:680,
		// 	height:1092
		// },

		// listTag:[
		// 	{
		// 		url:'https://img.alicdn.com/imgextra/i2/4161056916/O1CN01b5ZA1R20xZqoOfg19_!!4161056916.png'
		// 	},
		// 	{
		// 		url:'https://img.alicdn.com/imgextra/i3/4161056916/O1CN01AFWoHB20xZqZLfkiX_!!4161056916.png'
		// 	},
		// 	{
		// 		url:'https://img.alicdn.com/imgextra/i1/4161056916/O1CN01bYfJ7s20xZqhjQwUO_!!4161056916.png'
		// 	}
		// ],

		// listBg:{
		// 	url:'https://img.alicdn.com/imgextra/i3/4161056916/O1CN01lHaaXj20xZqhuA2Sk_!!4161056916.png'
		// },
		// listBg2:{
		// 	url:'https://img.alicdn.com/imgextra/i1/4161056916/O1CN01vpgUco20xZqnrb7TV_!!4161056916.png'
		// },

		// lingQuBtn:{
		// 	url:'https://img.alicdn.com/imgextra/i4/4161056916/O1CN01Bn4ofa20xZqfwpE4F_!!4161056916.png'
		// },

		activetyTime:'2021-02-05 18:27',

		hasPrize:false
  },
  props: {
		listData:"",
		timeDownIs:""
	},
	onInit(){

		this.$page.listPage = this

		this.eqActivityTime();

    this.getUserInfo();
    
    this.setData({
      ...getApp().pifu.listPage
    })
	},
  didMount() {




    this.animation = my.createAnimation();

    this.animation.translate('0%','150%').step()
    this.setData({ animation: this.animation.export() })

    // for(let i in this.props.listData){
    //   if(this.props.listData[i].openId == getApp().openId){
    //     this.setData({
    //       userInfo:this.props.listData[i]
    //     })
    //   }
		// }
		
		console.info(this.data.userInfo)
  },
  didUpdate() {},
  didUnmount() {},
  methods: {

		getUserInfo(){
			getApp().cloud.application.httpRequest({
				'path' : '/api/c/user/myRankingVo', 
				'method':'POST',
				'headers':{ "Content-Type":"application/json"},
				'params':{},
				'body':{},
				'exts':{}  }).then(res => {

				console.log("当前用户排名",res);

				//判断是否是正常状态
				if(res.code != 200){
					// my.alert({
					//   content:res.msg
					// }) 
				}else{
					
					this.setData({
						hasPrize:res.data.hasPrize > 0,
						prizeLog:res.data.prizeLog.id,
						giftType:res.data.giftType
					})
				
				}
			})
		},

		//获取活动时间  
		eqActivityTime(){
			getApp().cloud.application.httpRequest({
				
				'path' : '/api/c/user/currentActivityInfo', 
				'method':'POST',
				'headers':{ "Content-Type":"application/json"},
				'params':{},
				'body':{},
			
			'exts':{}  }).then(res => {
				console.info('获取活动时间',res)

				if(res.code != 200){

					my.showToast({content:res.msg});

					return
				}

				let time = res.data.activity.endTime

				this.setData({
					activetyTime:time
				})
			})
		},

    closeList(){
      
      this.animation.translate('0%','-150%').step()
      this.setData({ animation: this.animation.export() })

      setTimeout(() => {
        this.$page.setData({
          isScroll:false,
          isShowList:false
        })
      }, 400);
    },

    saveAddress(){

			if(this.data.giftType == 1){
				this.$page.gressNew(this.data.prizeLog);
			}else{
				my.showToast({
					content:"奖品已经自动发放"
				})
			}

			

		},
		
		upDateList(o){
			
			this.setData({
				userInfo:o
			})

		},

    

  },
});
